<?php
defined('BASEPATH') OR exit('No direct script access allowed');
$model_name=$channel['name'];
$model_sub_name=$channel['sub_name'];
$menu_name=$channel['en_name'];
$sub_meun_name='category';
$page_name="编辑".$model_sub_name."分类";
//error_reporting(0); //抑制所有错误信息
?>

<?php require_once 'public/header.php';?>
<?php require_once 'public/sidebar.php';?>

<div id="content">
    <div id="content-header">
      <div id="breadcrumb">
          <a href="<?php echo site_url($this->config->item('system_manage_path')."welcome");?>" title="系统首页" class="tip-bottom"><i class="icon-home"></i> 系统首页</a> 
          <a href="<?php echo site_url($this->config->item('system_manage_path').$menu_name);?>" title="<?php echo $model_name;?>列表" class="tip-bottom"><?php echo $model_name;?></a> 
          <a class="current"><?php echo $model_sub_name;?>分类</a> 
      </div>
      <h1><?php echo $model_sub_name;?>分类</h1>
    </div>
    
    <div class="container-fluid">
      <div class="row-fluid">
        <div class="alert alert-block"> <a class="close" data-dismiss="alert" href="#">×</a>
            <h4 class="alert-heading">注意：</h4>
            <span class="badge badge-warning">1</span> 删除分类同时将删除该分类下所有的<?php echo $model_sub_name;?>！<br />
            <span class="badge badge-warning">2</span> 有子分类的类别下,请勿添加<?php echo $model_sub_name;?>！ <br />
            <span class="badge badge-warning">3</span> 网站一但建立，请不要轻易删除某一分类，建议如果需要删除+添加操作请进行更新操作，如需大规模重置数据，请联系制作人员。 
        </div>
        <div class="widget-box">
          <div class="widget-title"> <span class="icon"> <i class="icon-align-justify"></i> </span>
            <h5>操作选项：<a href="<?php echo site_url($this->config->item('system_manage_path')."category/channel/".$channel['en_name']);?>">分类管理首页</a> | <a href="<?php echo site_url($this->config->item('system_manage_path')."category/".$channel['en_name']."/add");?>">新建<?php echo $model_sub_name;?>分类</a> </h5> 
          </div>  
          
          <div class="widget-content" style="padding-bottom:0px;">
            <form class="form-horizontal" method="post" action="<?php echo site_url($this->config->item('system_manage_path')."category/".$channel['en_name']."/save/edit/".$show['id']);?>" name="basic_validate" id="basic_validate" novalidate>
              <div class="control-group">
                <label class="control-label"><?php echo $model_sub_name;?>分类名称：</label>
                <div class="controls">
                  <input type="text" name="name" id="name" value="<?php echo $show['name']; ?>" class="span6">
                </div>
              </div>
              <div class="control-group">
                <label class="control-label"><?php echo $model_sub_name;?>分类关键词：</label>
                <div class="controls">
                  <input type="text" name="keywords" id="keywords" value="<?php echo $show['keywords']; ?>" class="span6">
                </div>
              </div>
              <div class="control-group">
                <label class="control-label"><?php echo $model_sub_name;?>分类描述：</label>
                <div class="controls">
                  <textarea id="description" name="description" class="span7" rows="5"><?php echo $show['description']; ?></textarea>
                </div>
              </div>
              <div class="control-group">
                <label class="control-label"><?php echo $model_sub_name;?>分类内容：</label>
                <div class="controls">
                  <textarea id="content" name="content" class="ckeditor" rows="5"><?php echo $show['content']; ?></textarea>
                </div>
              </div>
              <div class="control-group">
                <label class="control-label">所属类别：</label>
                <div class="controls">
                <select name="parent_id" style="width:220px;">
                    <option value="0"<?php if($show['parent_id']=='0'){?>selected<?php }?>>做为一级分类</option>
                    <?php foreach ($list as $value){ ?>
                    <option value="<?php echo $value['id'] ?>"<?php if($show['parent_id']===$value['id']){?> selected<?php }?>>
                    <?php
                    if ($value['depth']=='2'){
                      echo "├  "; 
                    }
                    if ($value['depth']>2){
                        for ($i = 2; $i < $value['depth']; $i++) {
                            echo "│ "; 
                        }
                        echo "├  ";
                    }
                    ?>
                    <?php echo $value['name'] ?></option>
                    <?php }?>
                </select>
              	</div>
              </div>
              <div class="control-group">
                <label class="control-label"><?php echo $model_sub_name;?>分类排序：</label>
                <div class="controls">
                  <input type="text" name="sort" id="sort" value="<?php echo $show['sort']; ?>" class="span1"> 数字越大，排序越后
                </div>
              </div>
              <div class="form-actions">
                <input type="submit" value="确定" class="btn btn-success">
                <input type="button" value="取消" class="btn btn-danger" onClick="javascript: location.href='<?php echo $comeurl?>';"  />       
                <input type="hidden" name="lcomeurl" value="<?php echo $comeurl?>" />
                <input type="hidden" name="channel_id" value="<?php echo $show['channel_id']; ?>" />
              </div>
            </form>
          </div>
          
        </div>
      </div>
    </div>
</div>

<?php require_once 'public/footer.php';?>